package com.king.run.base;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.support.multidex.MultiDexApplication;

import org.xutils.x;

/**
 * Email 674618016@qq.com
 * Created by shuiz_wade on 2017/1/11.
 */

public class MyApplication extends MultiDexApplication {
    private static MyApplication application;
    private Handler wxHandler;
    private static Context context;
    private static Handler mHandler;

    public static MyApplication getInstance() {
        if (application == null) {
            application = new MyApplication();
        }
        return application;
    }
    public static void doInMain(Runnable runnable) {
        mHandler.post(runnable);
    }

    public static void doInMain(Runnable runnable, long delay) {
        mHandler.postDelayed(runnable, delay);
    }
    @Override
    public void onCreate() {
        super.onCreate();
        context = this.getApplicationContext();
        x.Ext.init(this);
        mHandler = new Handler(Looper.getMainLooper());
    }

    public Handler getWxHandler() {
        return wxHandler;
    }

    public void setWxHandler(Handler wxHandler) {
        this.wxHandler = wxHandler;
    }

    public static Context getContext() {
        return context;
    }

}
